home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / biz / demo / StylusDemo.lha / Stylus_Demo / REXX / ToggleView.pvrx < prev    next >
Text File  |  1992-04-21  |  2KB  |  82 lines

  1. /* ToggleView.pvrx---Toggles:
  2.         FullView -> Selected Obj (or) FullView -> Last View
  3.         Selected Obj -> FullView
  4.         Last View -> FullView
  5.  
  6.    Suggested "ProVector.pvrx" entries:
  7.  
  8.         'RxDefine ToggleView'    /* Attach to Rx tool */
  9.         'Define "ToggleView    Ctrl-T" ToggleView'    /* User menu item */
  10.         'DefineKey T "ToggleView"'    /* Control Key */
  11.  
  12.     Copyright © 1992 by Stylus, Inc.
  13.     Author: Jeff Blume
  14. */
  15.  
  16. options results
  17.  
  18. /* Try to lock project window.
  19.     If can't get lock, do not proceed. */
  20. 'Lock'
  21. if rc ~= 0 then exit
  22.  
  23. ZmCat = ""
  24. /* Get previous view, if exists */
  25. /* "ZmCat" is a conCATenated string of coords */
  26. ZmCat = getclip("ZoomView")
  27.  
  28. /* Get the bounding box coords of any selected objs */
  29. 'SelExtent' Ext
  30. if rc = 0 then Sel = 1    
  31.  
  32. select
  33.     when Sel = 1 then call ZoomSel        /* Selected Obj exists, zoom it */
  34.     when ZmCat ~= "" then call ZoomOld    /* Previous view exists, use it */
  35.     otherwise call ZoomFull
  36. end
  37.  
  38. /* zoom into selected view */
  39. 'SetView Ext'
  40.  
  41. 'Repair'
  42. 'UnLock'
  43.  
  44. EXIT
  45.  
  46. ZOOMOLD:
  47.     do
  48.         Ext.X1 = word(ZmCat,1)
  49.         Ext.Y1 = word(ZmCat,2)
  50.         Ext.X2 = word(ZmCat,3)
  51.         Ext.Y2 = word(ZmCat,4)
  52.     end
  53.     call ClipView
  54.     return
  55.  
  56. ZOOMSEL:
  57.     if getclip(ZmSel) = 1 & ZmCat = ""
  58.         then do
  59.             call setclip ZmSel,0
  60.             call ZoomFull
  61.             return
  62.             end
  63.         else call setclip ZmSel,1
  64.     /* Border around objs 1/25th of view width */
  65.     Xborder = abs(Ext.X2-Ext.X1) / 25
  66.     /* Does this still assume 0,0 is up-left? */
  67.     Ext.X1 = Ext.X1 - Xborder; Ext.Y1 = Ext.Y1 - Xborder
  68.     Ext.X2 = Ext.X2 + Xborder; Ext.Y2 = Ext.Y2 + Xborder
  69.     call setclip "ZoomView",""
  70.     return
  71.  
  72. ZOOMFULL:
  73.     call ClipView
  74.     'GetPageSize' Ext
  75.     return
  76.  
  77. CLIPVIEW:
  78.     'GetView' CurExt
  79.     ZmCat = CurExt.X1||" "||CurExt.Y1||" "||CurExt.X2||" "||CurExt.Y2
  80.     call setclip "ZoomView",ZmCat
  81.     return
  82.